﻿@model HouseAppointmentDTO[]
@{
    ViewBag.Title = "预约看房列表";
}
<style type="text/css">
    #pager li {
        float: left;
        margin-left: 5px;
        color: purple;
    }

    .curPager {
        font-size: xx-large;
    }
</style>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 房源管理 <span class="c-gray en">&gt;</span> 预约看房列表 <a class="btn btn-success radius r btn-refresh" style="line-height:1.6em;margin-top:3px" href="javascript:;" onclick="javascript: location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="pd-20">
    <table class="table table-border table-bordered table-bg">
        <thead>
            <tr>
                <th scope="col" colspan="10">预约看房列表</th>
            </tr>
            <tr class="text-c">
                <th width="150">姓名</th>
                <th width="90">电话</th>
                <th width="90">预约时间</th>
                <th width="90">看房时间</th>
                <th width="90">小区</th>
                <th width="90">地址</th>
                <th width="90">状态</th>
                <th width="90">跟进员工</th>
                <th width="90">查看房源</th>
                <th width="100">接单</th>
            </tr>
        </thead>
        <tbody>
            @foreach (var app in Model)
            {
                <tr class="text-c">
                    <td>@app.Name</td>
                    <td>@app.PhoneNum</td>
                    <td>@app.CreateDateTime</td>
                    <td>@app.VisitDate</td>
                    <td>@app.CommunityName</td>
                    <td>@app.HouseAddress</td>
                    <td>@app.Status</td>
                    <td>@app.FollowAdminUserName</td>
                    <td><a href="~/House/Edit/@app.HouseId" target="_blank">查看房源</a></td>
                    <td class="td-manage">
                        <a title="抢单" href="javascript:;" onclick="follow(@app.Id)" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6d0;</i></a>
                    </td>
                </tr>
            }
        </tbody>
    </table>
    @{
        var pager = new ZSZ.Common.CommonPager();
        pager.CurrentPageClassName = "active";
        pager.MaxPagerCount = (int)ViewBag.maxPagerCount;
        pager.PageIndex = (int)ViewBag.pageIndex;//这些数据，cshtml不知道，就必须让Action传递给我们
                                                 //对于所有cshtml要用到，但是又获取不到的数据，都由Action来获取，然后放到ViewBag或者Model中传递给cshtml
        pager.PageSize = (int)ViewBag.pageSize;
        pager.TotalCount = (int)ViewBag.totalCount;
        pager.UrlPattern = "/WebAdmin/HouseAppointment/List?pageIndex={pn}";
    }
    <div id="pager">
        @Html.Raw(pager.GetPagerHtml()) </ div >
    </div>
</div>
@section FooterScript
{
    <script type="text/javascript">

function follow(appId) {
    $.ajax({
        url: "/WebAdmin/HouseAppointment/Follow",
        type: "post",
        dataType: "json",
        data:{appId:appId},
        success:function(res)
        {
            if(res.status=="ok")
            {
                layer.msg('抢单成功!', { icon: 1, time: 2000 }, function () {
                    $(".btn-refresh").click();
                });
            }
            else if(res.status=="fail")
            {
                layer.msg('抢单失败', { icon: 2, time: 2000 });
            }
            else
            {
                layer.msg('网络出错', { icon: 2, time: 2000 });
            }
        },
        error:function(){
            layer.msg('网络出错!', { icon: 2, time: 2000 });
        }
    });
}
    </script>
}